<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('主子表提交')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <style>
        input::-webkit-outer-spin-button,
        input::-webkit-inner-spin-button {
            -webkit-appearance: none;
        }

        input[type="number"] {
            -moz-appearance: textfield;

        }

    </style>

</head>


<body class="gray-bg">

<div class="main-content">
    <form id="form-add" class="form-horizontal">

        <input name="companyId" type="hidden" id="companyId"/>
        <input name="programId" type="hidden" id="programId"/>
        <input name="programName" type="hidden" id="programName"/>
        <input name="excellenceId" type="hidden" id="excellenceId"/>

        <h4 class="form-header h4"><span class="h4" th:text="${programName}"></span> &nbsp;&nbsp; 流程信息</h4>
        <div class="row">
            <div class="col-sm-12">
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存
        </button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭
        </button>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:src="@{/js/jquery.tmpl.js}"></script>

<script th:inline="javascript">

    /* 模块前缀url */
    var prefix = ctx + "excellenceMonitor";

    /* 初始化 数据 */
    var excellenceId = [[${excellenceId}]];

    /* 初始化 方法 */
    $(function () {
        $("#excellenceId").val(excellenceId);
        var options = {
            url: prefix + "/list?excellenceId=" + excellenceId,
            pagination: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            sidePagination: "client",
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'manTel',
                    align: 'center',
                    width:200,
                    title: '项目经理及联系方式',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='excellence[%s].manTel' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'responTel',
                    align: 'center',
                    width:200,
                    title: '项目技术负责人及联系方式',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='excellence[%s].responTel' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'target',
                    align: 'center',
                    width:200,
                    title: '创优创标目标',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='excellence[%s].target' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'finishTime',
                    align: 'center',
                    width:200,
                    title: '计划完成时间节点',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' id='finishTime' name='excellence[%s].finishTime' placeholder='yyyy-MM-dd' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },

                {
                    field: 'projectPlanTime',
                    align: 'center',
                    width:200,
                    title: '立项计划时间',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' id='projectPlanTime' name='excellence[%s].projectPlanTime' placeholder='yyyy-MM-dd' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'declarePlanTime',
                    align: 'center',
                    width:200,
                    title: '申报计划时间',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' id='declarePlanTime' name='excellence[%s].declarePlanTime' placeholder='yyyy-MM-dd' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'reviewPlanTime',
                    align: 'center',
                    width:200,
                    title: '评审计划时间',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' id='reviewPlanTime' name='excellence[%s].reviewPlanTime' placeholder='yyyy-MM-dd' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'releaseExpectedTime',
                    align: 'center',
                    width:200,
                    title: '公布预计时间',
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' id='releaseExpectedTime' name='excellence[%s].releaseExpectedTime' placeholder='yyyy-MM-dd' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                },

                {
                    field: 'note',
                    align: 'center',
                    title: '备注',
                    width:200,
                    formatter: function (value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='excellence[%s].note' value='%s' autocomplete='off'>", index, value);
                        return html;
                    }
                }
            ]
        };
        $.table.init(options);

        bindDatetimepicker();
    });

    /* 初始化 日期*/
    function bindDatetimepicker() {
        setTimeout(function () {
            $("#finishTime").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });

            $("#projectPlanTime").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
            $("#declarePlanTime").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
            $("#reviewPlanTime").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
            $("#releaseExpectedTime").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
        }, 100)
    }

    /* 主子表-提交 */
    function submitHandler() {
        var data = $("#form-add").serializeArray();
        $.operate.saveTab(prefix + '/update', data);
    }

</script>
</body>
</html>
</script>